package com.groupfifteen.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.groupfifteen.entity.SysAdminEntity;
import com.groupfifteen.entity.SysLoginEntity;
import com.groupfifteen.entity.SysTeacherEntity;
import com.groupfifteen.entity.SysUserEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface SysLoginDao extends BaseMapper<SysLoginEntity> {
    //用户登录
    @Select("select id,user_name,sex,status,email,id_no,password,user_icon,real_name from userinfo where id = #{id} and password = #{password}")
    SysUserEntity userLogin(@Param("id") Integer id, @Param("password") String password);
    //教师登录
    @Select("select teacher_id,teacher_name,institute,sex,tel,email,card_id," +
            "type,role from sys_teacher where teacher_id = #{id} and pwd = #{password}")
    SysTeacherEntity teacherLogin(@Param("id") Integer id, @Param("password") String password);
    //管理员登录
    @Select("select admin_id,admin_name,sex,tel,email,card_id,role from sys_admin where admin_id = #{id} and pwd = " +
            "#{password}")
    SysAdminEntity adminLogin(@Param("id") Integer id, @Param("password") String password);

}

